package com.lx.patterns.command;

import java.util.Map;
import java.util.Set;

public class OrderCommand implements Command{

    private SeniorChef receiver;

    private Order order;

    public OrderCommand(SeniorChef receiver, Order order) {
        this.receiver = receiver;
        this.order = order;
    }


    @Override
    public void execute() {
        System.out.println(order.getDiningTable() + "桌的订单：");
        Map<String, Integer> foodDic = order.getFoodDic();
        Set<String> keys = foodDic.keySet();
        for (String foodName : keys) {
               receiver.makeFood(foodDic.get(foodName),foodName);
        }
        System.out.println(order.getDiningTable() + "桌的订单已做好");
    }
}
